package logic

import (
	"context"
	"gitignore/models/mysql"

	"gitignore/gitignorerpc/gitignorerpc"
	"gitignore/gitignorerpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type CommentListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCommentListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentListLogic {
	return &CommentListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CommentListLogic) CommentList(in *gitignorerpc.CommentListRequest) (*gitignorerpc.CommentListResponse, error) {
	// todo: add your logic here and delete this line
	var comment mysql.Comment

	var list []*gitignorerpc.CommentList

	list = comment.FindCommentByList(mysql.DB, list, in)

	return &gitignorerpc.CommentListResponse{
		List: list,
	}, nil
}
